/*
 * @(#)AutoCompleteInputBoxTag.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.framework;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import uk.ltd.getahead.dwr.ExecutionContext;

/**
 DWRFacade.java
 
 @author      Jim Zhou
 @company     DCIVision Limited
 @creation date   2006/09/19
 @version     $Revision: 1.3.4.1 $
 */

public class DWRFacade {
  
  public DWRFacade() {
    super();
    
  }
  
  /**
   * get sessioncontainer
   * @return                 SessionContainer
   */
  public SessionContainer getSessionContainer(){
    HttpSession session = ExecutionContext.get().getSession();
    return (SessionContainer) session.getAttribute(GlobalConstant.SESSION_CONTAINER_KEY);
  }
  
  /**
   * get sessioncontainer by HttpServletRequest
   * @param request          HttpServletRequest
   * @return                 SessionContainer
   */
  public SessionContainer getSessionContainer(HttpServletRequest request){
    SessionContainer ctx = (SessionContainer)request.getSession().getAttribute(GlobalConstant.SESSION_CONTAINER_KEY);
    if (ctx==null) {
      ctx = new SessionContainer();
      request.getSession().setAttribute(GlobalConstant.SESSION_CONTAINER_KEY, ctx);
    }
    return(ctx); 
  }
  
}
